from graphics import *
from ai import *
from ui import *
from board import *
from score import *
from menu import *
from persistence import *
from boardinterpretation import *
from gameinput import *
from splashload import *





class Logic:
    __slots__=("graphics", "ai", "board", "score", "menu", "persistence",\
               "gameinput", "boardinterp", "ui")
    
    def __init__(self):
        print("init Logic")
        self.graphics = Graphics()
        self.ai = Ai()
        #self.board = Board(map)
        self.score = Score()
        self.menu = Menu()
        self.persistence = Persistence()
        self.gameinput = Gameinput()
        self.boardinterp = Boardinterp()
        self.ui = Ui()
        
        
        self.load()
        
        #call a menu function here and use it to determine
        #what to do and what to load
        
        #load map and towers ect before entering mainloop
        self.mainloop()
        
    
    #call s.next() between each load call to update the splash screen load bar
    def load(self):
        print("Logic load---")
        s = Splashload(2, self.graphics.screen)
        self.graphics.load()
        s.next()
        self.ui.load()
        s.next()

    def draw(self):
        pass
        #self.board.draw()

    def mainloop(self):        
        
        while not self.gameinput.exit():
            self.gameinput.getinput()
            


            self.draw()
            

            self.graphics.updatescreen()

        self.graphics.cleanup()















